﻿namespace Lanbt.Core.Entity.Dto
{
    public class ResultOutput<T> : ResultOutputBase
    {
        public ResultOutput() { }


        public ResultOutput(T result)
        {
            Result = result;
        }

        /// <summary>
        /// 结果数据
        /// </summary>
        public T Result { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public ResultOutput<T> AddError(string errMsg)
        {
            ErrorMsg = errMsg;
            return this;
        }

        /// <summary>
        /// 添加返回结果
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public ResultOutput<T> ResultInput(T obj)
        {
            Result = obj;
            return this;
        }
    }

    public class ResultOutput : ResultOutput<string>
    {
        public ResultOutput()
        {
            Result = "操作成功";
        }

        public ResultOutput(string result)
        {
            Result = result;
        }

        /// <summary>
        /// 错误信息
        /// </summary>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public new ResultOutput AddError(string errMsg)
        {
            ErrorMsg = errMsg;
            return this;
        }

        /// <summary>
        /// 添加返回结果
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public new ResultOutput ResultInput(string obj)
        {
            Result = obj;
            return this;
        }
    }
}
